This notebook will begin looking at clustering methods on the expression of the genes in a single sample of the dataset of interest, from an unbiased approach.
# Load libraries
library(magrittr)
library(scater)
library(readr)
library(bluster)
library(ggpubr)
library(pheatmap)
# Set file paths
data_dir <- file.path("results", "Gawad_processed_data")
# Source custom functions script
source(file.path("utils", "clustering-functions.R"))
sample_290_normalized <- read_rds(
file.path(data_dir, "SCPCS000216", "SCPCL000290_miQC_downstream_processed_normalized_reduced_sce.rds"))
# Perform k-means clustering
kmeans_cluster_names <- paste("kmeans", c(2:5), sep = "_")
sample_290_normalized <- kmeans_clustering(
sample_290_normalized,
k_range = c(2:5),
check_stability = TRUE
)
# Plot k-means
kmeans_plot_list <- kmeans_cluster_names %>%
purrr::map(~ plotReducedDim(sample_290_normalized, dimred = "UMAP", colour_by = .x))
cowplot::plot_grid(plotlist = kmeans_plot_list, ncol = 4)
# Perform graph-based walktrap clustering
walktrap_cluster_names <-paste("walktrap", c(5, 10, 15, 20, 25), sep = "_")
sample_290_normalized <- graph_clustering(
sample_290_normalized,
nn_range = c(5, 10, 15, 20, 25),
weighting_type = "rank",
cluster_function = "walktrap",
check_stability = TRUE
)
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
# Plot
walktrap_plot_list <- walktrap_cluster_names %>%
purrr::map(~ plotReducedDim(sample_290_normalized, dimred = "UMAP", colour_by = .x))
cowplot::plot_grid(plotlist = walktrap_plot_list, ncol = 3)
# Perform graph-based louvain clustering
louvain_cluster_names <- paste("louvain", c(5, 10, 15, 20, 25), sep = "_")
sample_290_normalized <- graph_clustering(
sample_290_normalized,
nn_range = c(5, 10, 15, 20, 25),
weighting_type = "jaccard",
cluster_function = "louvain",
check_stability = TRUE
)
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
Warning in (function (to_check, X, clust_centers, clust_info, dtype, nn, :
detected tied distances to neighbors, see ?'BiocNeighbors-ties'
# Plot
louvain_plot_list <- louvain_cluster_names %>%
purrr::map(~ plotReducedDim(sample_290_normalized, dimred = "UMAP", colour_by = .x))
cowplot::plot_grid(plotlist = louvain_plot_list, ncol = 3)
# Check the k-means cluster validity stats for each of the clusters and produce
# a summary data frame of these stats to be stored within the SCE object
kmeans_stats_df <- add_metadata_clustering_stats(sample_290_normalized, c(2:5), "kmeans")
Joining, by = "cell_barcode"
Joining, by = "cell_barcode"
Joining, by = "cell_barcode"
Joining, by = "cell_barcode"
# Preview the results
head(kmeans_stats_df)
# Summarize the stats
kmeans_summary_stats_df <- summarize_clustering_stats(kmeans_stats_df)
# Preview the summary results
head(kmeans_summary_stats_df)
# Plot individual cluster and summary stats
kmeans_purity_plots <- plot_clustering_validity(kmeans_stats_df, "purity", "maximum", "cluster_names", "purity")
kmeans_purity_plots
# Plot individual cluster and summary stats
kmeans_silhouette_plots <- plot_clustering_validity(kmeans_stats_df, "width",
"closest", "cluster_names", "silhouette")
kmeans_silhouette_plots
# Check the walktrap cluster validity stats for each of the clusters and return
# Plot individual cluster and summary stats
walktrap_purity_plots <- plot_clustering_validity(walktrap_stats_df,
"purity", "maximum", "cluster_names", "purity")
walktrap_purity_plots
# Plot individual cluster and summary stats
walktrap_silhouette_plots <- plot_clustering_validity(walktrap_stats_df,
"width", "closest", "cluster_names", "silhouette")
walktrap_silhouette_plots
# Check the louvain cluster validity stats for each of the clusters and return
# stats in a data frame
louvain_stats_df <- add_metadata_clustering_stats(sample_290_normalized, c(5, 10, 15, 20, 25), "louvain")
Joining, by = "cell_barcode"
Joining, by = "cell_barcode"
Joining, by = "cell_barcode"
Joining, by = "cell_barcode"
Joining, by = "cell_barcode"
# Preview the results
head(louvain_stats_df)
# Summarize the stats and return in a data frame
louvain_summary_stats_df <- summarize_clustering_stats(louvain_stats_df)
# Preview the summary results
head(louvain_summary_stats_df)
# Plot individual cluster and summary stats
louvain_purity_plots <- plot_clustering_validity(louvain_stats_df,
"purity", "maximum", "cluster_names", "purity")
louvain_purity_plots
# Plot individual cluster and summary stats
louvain_silhouette_plots <- plot_clustering_validity(louvain_stats_df,
"width", "closest", "cluster_names", "silhouette")
louvain_silhouette_plots
# Check and plot cluster stability
kmeans_cluster_names %>%
purrr::walk(~ plot_cluster_stability(sample_290_normalized, .x))
walktrap_cluster_names %>%
purrr::walk(~ plot_cluster_stability(sample_290_normalized, .x))
louvain_cluster_names %>%
purrr::walk(~ plot_cluster_stability(sample_290_normalized, .x))
sessionInfo()
R version 4.1.2 (2021-11-01)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.3 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/openblas/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/libopenblasp-r0.2.20.so
locale:
[1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8 LC_COLLATE=C.UTF-8
[5] LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8 LC_PAPER=C.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats4 stats graphics grDevices datasets utils methods base
other attached packages:
[1] pheatmap_1.0.12 ggpubr_0.4.0 bluster_1.4.0
[4] readr_2.1.1 scater_1.22.0 ggplot2_3.3.5
[7] scuttle_1.4.0 SingleCellExperiment_1.16.0 SummarizedExperiment_1.24.0
[10] Biobase_2.54.0 GenomicRanges_1.46.1 GenomeInfoDb_1.30.0
[13] IRanges_2.28.0 S4Vectors_0.32.3 BiocGenerics_0.40.0
[16] MatrixGenerics_1.6.0 matrixStats_0.61.0 magrittr_2.0.1
loaded via a namespace (and not attached):
[1] ggbeeswarm_0.6.0 colorspace_2.0-2 ggsignif_0.6.3
[4] ellipsis_0.3.2 modeltools_0.2-23 rprojroot_2.0.2
[7] XVector_0.34.0 BiocNeighbors_1.12.0 rstudioapi_0.13
[10] farver_2.1.0 getopt_1.20.3 ggrepel_0.9.1
[13] flexmix_2.3-17 fansi_0.5.0 splines_4.1.2
[16] sparseMatrixStats_1.6.0 knitr_1.36 polyclip_1.10-0
[19] jsonlite_1.7.2 broom_0.7.10 cluster_2.1.2
[22] ggforce_0.3.3 BiocManager_1.30.16 compiler_4.1.2
[25] dqrng_0.3.0 backports_1.4.0 Matrix_1.3-4
[28] fastmap_1.1.0 cli_3.1.0 limma_3.50.0
[31] tweenr_1.0.2 BiocSingular_1.10.0 miQC_1.2.0
[34] htmltools_0.5.2 tools_4.1.2 rsvd_1.0.5
[37] igraph_1.2.9 gtable_0.3.0 glue_1.5.1
[40] GenomeInfoDbData_1.2.7 dplyr_1.0.7 Rcpp_1.0.7
[43] carData_3.0-4 vctrs_0.3.8 DelayedMatrixStats_1.16.0
[46] optparse_1.7.1 xfun_0.28 stringr_1.4.0
[49] beachmat_2.10.0 lifecycle_1.0.1 irlba_2.3.3
[52] renv_0.14.0 statmod_1.4.36 rstatix_0.7.0
[55] edgeR_3.36.0 zlibbioc_1.40.0 MASS_7.3-54
[58] scales_1.1.1 hms_1.1.1 parallel_4.1.2
[61] RColorBrewer_1.1-2 yaml_2.2.1 gridExtra_2.3
[64] stringi_1.7.6 ScaledMatrix_1.2.0 scran_1.22.1
[67] BiocParallel_1.28.2 rlang_0.4.12 pkgconfig_2.0.3
[70] bitops_1.0-7 evaluate_0.14 lattice_0.20-45
[73] purrr_0.3.4 labeling_0.4.2 cowplot_1.1.1
[76] tidyselect_1.1.1 here_1.0.1 R6_2.5.1
[79] generics_0.1.1 metapod_1.2.0 DelayedArray_0.20.0
[82] pillar_1.6.4 withr_2.4.3 abind_1.4-5
[85] RCurl_1.98-1.5 nnet_7.3-16 tibble_3.1.6
[88] crayon_1.4.2 car_3.0-12 utf8_1.2.2
[91] tzdb_0.2.0 rmarkdown_2.11 viridis_0.6.2
[94] locfit_1.5-9.4 grid_4.1.2 digest_0.6.29
[97] tidyr_1.1.4 munsell_0.5.0 beeswarm_0.4.0
[100] viridisLite_0.4.0 vipor_0.4.5